from dotenv import load_dotenv

from langchain.chat_models import init_chat_model

from langchain_core.messages import HumanMessage, SystemMessage
import os

load_dotenv()

def chatbot():
    messages = [
        SystemMessage(content="Translate the following from English into chinese"),
        HumanMessage(content="angGraph Platform, our infrastructure for deploying and managing agents at scale, is now generally available. Learn how to deploy here."),
    ]

    api_key = os.getenv("DEEPSEEK_API_KEY")
    model = init_chat_model("deepseek-chat", model_provider="deepseek", openai_api_key=api_key)
    return model.stream(messages)

def chatbot2():
    messages = [
        SystemMessage(content="Translate the following from English into chinese"),
        HumanMessage(content="Design agents that can handle sophisticated tasks with control. Add human-in-the-loop to steer and approve agent actions."),
    ]
    api_key = os.getenv("DEEPSEEK_API_KEY")
    model = init_chat_model("deepseek-chat", model_provider="deepseek", openai_api_key=api_key)
    return model.stream(messages)

if __name__ == "__main__":
    for chunk in chatbot():
        if chunk.content:
            print(chunk.content, end="", flush=True)
